﻿@model PagedList.IPagedList <ThesisSystem.Models.Target>
@{
    var targetsSearch = ViewBag.Current as ThesisSystem.ViewModels.TargetsSearch;
    }
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>指标查询</title>
    <link href="../../Content/CSS/searchstyle.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />

</head>
<body>
    <div class="Search_thesis">
        <h3>
            指标检索</h3>
        @*查询条件*@
        <div class="sch_areas" align="center">
            @using (Html.BeginForm())
            {
                <div id="Summary" style="float: left; width: 43%; overflow: hidden; margin: 2px">
                    <span>指标概括：</span> @Html.TextBox("Summary", targetsSearch.Summary as string)
                    </div>
                    <div id="studyProfessional" style="float: left; width: 38%; overflow: hidden; margin: 2px">
                        <span>适用学科：</span> @Html.DropDownList("TypeName",string.Empty)
                    </div>
                    <br />
                    
                    <div id="reviewStatus" style="float: left; width: 43%; overflow: hidden; margin: 2px;
                        clear: left">
                        <span>指标权重：</span> @Html.TextBox("Weight", targetsSearch.Weight as string)
                    </div>
                    <div id="thesisType" style="float: left; width: 46%; overflow: hidden; margin: 2px">
                        <span>所属评卷：</span> @Html.TextBox("title", targetsSearch.Title as string)
                    </div>
       
                    <p align="center" style="height: 28px; border: 1px solid #c3e1c9; margin: 2px; padding: 1px;
                        clear: left">
                        <input type="submit" value="检索" id="Searchbtn" />
                        <input type="reset" value="重置" id="Searchreset" />
                        <input type="button" onclick="javascript:window.history.go(-1);" value="返回上一页" id="Back" />
                    </p>

          }
                </div>  
    
@* 查询列表*@
                <div class="sch_area">
                    <table width="100%" class="lst_tbl" cellspacing="1px">
                        <tr>
                            <th align="center" class="crd_th" width="20%">
                                指标概括
                            </th>
                            <th align="center" class="crd_th" width="23%">
                                适用学科
                            </th>
                            <th align="center" class="crd_th" width="5%">
                                指标权重
                            </th>
                            <th align="center" class="crd_th" width="27%">
                                指标内容
                            </th>
                            <th align="center" class="crd_th" width="9%">
                                所属评卷
                            </th>
                               <th align="center" class="crd_th" width="15%">
                                操作
                            </th>
                        </tr>
                        @foreach (var item in Model)
            {
                            <tr>
                                <td class="crd_td">
                                    @Html.DisplayFor(modelItem => item.Summary)
                                </td>
                                <td class="crd_td">
                                    @Html.DisplayFor(modelItem => item.TypeName)
                                </td>
                                <td class="crd_td">
                                    @Html.DisplayFor(modelItem => item.Weight)
                                </td>
                                <td class="crd_td">
                                    @Html.DisplayFor(modelItem => item.Content)
                                </td>
                                  <td class="crd_td">
                                    @foreach(var marking in item.Markings){
                                        @Html.DisplayFor(modelItem => marking.Title) @:<br />
                                    }
                                </td>
                                <td class="crd_td">
                                    @Html.ActionLink("查看", "Details", new { id = item.TargetID }, new { id = "LockD" })
                                    @Html.ActionLink("编辑", "Edit", new { id = item.TargetID }, new { id = "Edit" })
                                    @Html.ActionLink("删除", "Delete", new { id = item.TargetID }, new { id = "Delete" })
                                </td>
                            </tr>
            }
                    </table>
                </div>
                <div class="sch_area">
                    <p align="left" style="height: 30px; border: 1px solid #c3e1c9; margin: 1px; padding: 1px;
                        clear: left">
                        @*分页部分*@
                        @if (Model.PageCount > 1)
                {

                    if (Model.IsFirstPage)
                    {
                        ////当为第一页时，下一页为空链接
                            @:<a>首页</a> @Html.Encode("-")
                           @:<a>上一页</a>
                    }
                    else
                    {
                            @Html.ActionLink("首页", "Search", new { id = Request.QueryString["id"], page = 1, Current = ViewBag.Current })@Html.Encode("-")
                            @Html.ActionLink("上一页", "Search", new { id = Request.QueryString["id"], page = Model.PageIndex, Current = ViewBag.Current })
                    }
                             @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)  @:/ @(Model.PageCount)
                    if (Model.IsLastPage)
                    {
                        //当为最后一页时，下一页为空链接
                
                                    @:<a>下一页</a>@Html.Encode("-")
                       @:<a>尾页</a>
                    }
                    else
                    {

                //PageIndex为索引值，初始值为0，值为page-1。上一页为PageIndex,下一页为 PageIndex+2
                            @Html.ActionLink("下一页", "Search", new { id = Request.QueryString["id"], page = Model.PageIndex + 2, Current = ViewBag.Current }) @Html.Encode("-")
                
                            @Html.ActionLink("尾页", "Search", new { id = Request.QueryString["id"], page = Model.PageCount, Current = ViewBag.Current })
                      }
               }

            
                    </p>
                </div>

                @Content.Script("jquery-min.js", Url) 
                @Content.Script("jquery-ui-min.js", Url)
                <script type="text/javascript">
                    $(document).ready(function () {
                        $("#Searchbtn").button();
                        $("#Searchreset").button();
                        $("#Back").button();
//                        $("#LockD").button();
//                        $("#Edit").button();
//                        $("#Delete").button();
                    });
                </script>
                </div>
</body>
</html>
